package com.lg.patter.behavior.observed;

import java.util.Observable;
import java.util.Observer;

/**
 * 观察者是 老师
 * 被观察者是 课程
 *
 * @author by Mr. Li 2020/5/8 19:19
 */
public class Teacher implements Observer {
    private String teacherName;

    public Teacher(String teacherName) {
        this.teacherName = teacherName;
    }

    @Override
    public void update(Observable o, Object arg) {
        Course course = (Course) o;

        Question question = (Question) arg;
        System.out.println(teacherName + "接受到了" + question.getUserNAME() +
                "的问题" + course.getCourseName() + "内容：" + question.getQuestionContent());
    }
}
